﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IronTrishul;
using System.Diagnostics;
using IronTrishul.Compiler;
using System.Reflection;
using IronTrishul.Elastic;
using System.Xml.Linq;
namespace WebTestharness
{
    public partial class DLR : System.Web.UI.Page
    {
        Uri Uri = new Uri(@"http://localhost:1738/Service/ResumeDataService.svc/");

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                lstExperience.SelectedIndex = 1;
                ResumeADOService.ResumeDatabaseEntities can = new ResumeADOService.ResumeDatabaseEntities(Uri);
                var skills = from skils in can.skillmasters
                             select skils;
                foreach (var v in skills.ToArray())
                {
                    ListItem item = new ListItem();
                    item.Value = v.skillid.ToString();
                    item.Text = string.Format("{0} - Family {1}", v.skillname, v.skillfamily);
                    lstSkills.Items.Add(item);
                }
            }

        }

        protected void btnPostAds_Click(object sender, EventArgs e)
        {
            List<string> vendors = new List<string>();
            vendors.Add("http://localhost:3021");
            string adsxml = txtXML.Text;

        }

        protected void btnGetXML_Click(object sender, EventArgs e)
        {
            GetXML();
        }

        private void GetXML()
        {
         
            dynamic xml = new ElasticObject("advertizement");
            xml.Name = "MonSoon.NET";
            xml.PublishDate = DateTime.Now;
            xml.ContactEmail = "pijush__kanti_biswas@dell.com";

            xml.Requirements.Requirement.SkillID = "1";
            xml.Requirements.Requirement.SkillName = "asp.net";
            xml.Requirements.Requirement.SkillFamily = "C#";
            xml.Requirements.Requirement.MinimumExperienceInMonths = "12";

            XElement el = !xml;

            txtXML.Text = el.ToString();
        }

   

        protected void FormViewConsultant_PageIndexChanging(object sender, FormViewPageEventArgs e)
        {

        }

        protected void DetailsViewConsultant_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
        {
            GridViewConsultant.DataBind();
        }
    }
}